{% if userinfo %}
<script>
    function info_del(info_id) {
        var statu = confirm("{{ _('Are you sure to delete the current data') }}?");
        if (!statu) {
            return false;
        }
        var AjaxUrl = "/post_j/_delete/" + info_id;
        var rout = "{{kwd['router']}}";
        var rout_url = "{{kwd['url']}}";
        $.getJSON(AjaxUrl, function (Json) {
            var obj = eval(Json);
            if (obj.del_info == 1) {
                if (rout_url == 'filter') {
                    router = "filter";
                    catid = obj.cat_id;
                }
                else if (rout_url == 'list') {
                    router = "list";
                    catid = obj.cat_slug;
                }
                else if (rout_url == 'tutorial') {
                    router = "catalog";
                    catid = obj.cat_slug;
                } else {
                    if (rout == 'tutorial') {
                        router = "catalog";
                        catid = obj.cat_slug;
                    }
                    else if (rout == 'info') {
                        router = "filter";
                        catid = obj.cat_id;
                    }
                    else {
                        router = "list";
                        catid = obj.cat_slug;
                    }
                }


                if (catid != '') {
                    window.location.href = '/' + router + '/' + catid;
                }
                else {
                    self.location = document.referrer;
                }
            }
            else {
            }

        });


    }


</script>
<div class="btn-group">

    {% if kwd['edit'] or userinfo.user_name=='admin' %}

    <a href="/{{kwd['router']}}/_edit/{{ kwd['uid']  }}" class="btn btn-xs btn-warning">
        <span class="glyphicon glyphicon-pencil"></span>
        {{ _('Edit') }}
    </a>


    {% else %}

    <a href="/{{ 'wiki' if kwd['router'] == 'wiki' else 'meta' }}_man/edit/{{kwd['uid'] }}"
       class="btn btn-xs btn-warning"><span class="glyphicon glyphicon-pencil"></span>
        {{ _('Help edit') }}
    </a>

    {% end %}
    {% if kwd['review'] or userinfo.user_name=='admin'  %}


    <a href="/{{ 'wiki' if kwd['router'] == 'wiki' else 'meta' }}_man/view/{{ kwd['uid']  }}"
       class="btn btn-xs btn-success">
        <span class="glyphicon glyphicon-eye-open"></span>
        {{ _('Review') }}
    </a>


    {% end %}


    {% if kwd['router'] != 'map' %}
    {% if kwd['reclass'] or userinfo.user_name=='admin' %}
    <a href="/post/_edit_kind/{{ kwd['uid']  }}" class="btn btn-xs btn-info">{{ _('Reclassify') }}</a>

    {% end %}
    {% end %}

    {% if kwd['nullify'] or userinfo.user_name=='admin' %}
    {% module info_nullify(uid = kwd['uid'],router=kwd['router'],url=kwd['url'])%}
    {% end %}
    {% if kwd['delete'] or userinfo.user_name=='admin' %}
    <a onclick="info_del('{{kwd['uid']}}')" class="btn btn-xs btn-danger">
        <span class="glyphicon glyphicon-trash"></span>
        {{ _('Delete') }}
    </a>
    {% end %}


</div>
{% else %}
<div class="btn-group">

    <a href="/{{ 'wiki' if kwd['router'] == 'wiki' else 'meta' }}_man/edit/{{kwd['uid'] }}"
       class="btn btn-xs btn-warning">
        <span class="glyphicon glyphicon-pencil"></span>
        {{ _('Help edit') }}
    </a>

</div>
{% end %}
